<template>
  <router-view />
</template>

<script>
import { App } from '@capacitor/app';
import VConsole from 'vconsole';

export default {
  mounted() {
    this.setupDeepLinkListener();
    new VConsole();
  },
  methods: {
    setupDeepLinkListener() {
      // 监听应用打开事件
      App.addListener('appUrlOpen', (event) => {
        // 示例 URL：yourscheme://open?page=home&id=123
        const url = new URL(event.url);
        
        // 解析参数
        const params = Object.fromEntries(url.searchParams.entries());
        
        // 执行路由跳转（示例）
        if (params) {
          this.$router.push({ path: '/auth-callback', query: params });
        }
      });
    }
  },
  beforeUnmount() {
    // 清理监听器（可选）
    App.removeAllListeners();
  }
}
</script>
